# Maintainer: Daniel Sabogal <dsabogalcc@gmail.com>
pkgname=hwloc
pkgver=1.11.13
pkgrel=2
pkgdesc="Portable abstraction of hierarchical hardware architectures"
url="https://www.open-mpi.org/"
arch="all"
license="BSD-3-Clause"
makedepends="cairo-dev eudev-dev libxml2-dev ncurses-dev"
case "$CARCH" in
	arm*) true;;
	*) makedepends="$makedepends numactl-dev";;
esac
options="!check" # fails on multiple arches with different tests
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools:_tools"
source="https://www.open-mpi.org/software/hwloc/v${pkgver%.*}/downloads/$pkgname-$pkgver.tar.bz2"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--sbindir=/usr/bin \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make -C "$builddir" check
}

package() {
	make -C "$builddir" DESTDIR="$pkgdir" install
}

_tools() {
	pkgdesc="Portable hardware locality tools"

	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}

sha512sums="dd38bcc9a5df2dcfd3bbd828ab13fdb1c1d21747a0b62e6c87df95d2835c0472590344ff5bda4f6c28e597eaba1ea11c0bc96907ad45f1215f51f95ac9f58138  hwloc-1.11.13.tar.bz2"
